#!/bin/bash
###
 # @Author: dvlproad
 # @Date: 2023-02-27 19:02:53
 # @LastEditors: dvlproad
 # @LastEditTime: 2023-02-28 14:55:32
 # @Description: 
### 
# 拷贝文件到指定目录下
#sh app_info_move_in.sh -sf "app_info.json" -tf "${WORKSPACE}/flutter_updateversion_kit/assets/data/app_info.json"

# 包来源分支
# shell 参数具名化
show_usage="args: [-sp , -tp]\
                                  [--source-file=, --target-file=]"

while [ -n "$1" ]
do
        case "$1" in
                -sf|--source-file) SourceFilePath=$2; shift 2;;
                -tf|--target-file) TargetFilePath=$2; shift 2;;
                --) break ;;
                *) echo $1,$2,$show_usage; break ;;
        esac
done


TargetFileDir="${TargetFilePath%/*}"
if [ ! -d "$TargetFileDir" ];then
    mkdir -p ${TargetFileDir}   # 添加 -p 选项 可以使得连续创建成功 mkdir -p "${WORKSPACE}/flutter_updateversion_kit/assets/data3/data2/data1"
    echo "TargetFileDir:${TargetFileDir}文件夹创建成功"
#else
#    echo "assets文件夹已经存在"
fi

cp ${SourceFilePath} ${TargetFilePath}

